-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Fixed customertoken not generating after configured failure in a row #34001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed customertoken not generating after configured failure in a row #34001
Conversation
When we have more login failure in the api for creation of token than the configured times. It does not allow us to generate new token because there is no any check of 'lock_expires_at'.
…rateCustomerToken Fixed the not expiry of token in generateCustomerToken graphql
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code here looks fine but you need to properly fill out the PR description to explain the issue being solved, what the fix does and how to test (if appropriate)
A good example of a PR description : #33998
@BarnyShergold I have updated the description. Please check and let me know if you need more clarification or anything else needed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Excellent update
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
Hi @BarnyShergold, thank you for the review.
|
@magento run all tests again. |
Failed to run the builds. Please try to re-run them later. |
@BarnyShergold , Can you please let me know why this issue is occuring, i think it is more of a code style rather than code ? Can you please suggest ? Thanks in advance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try this update to start
app/code/Magento/Integration/Model/ResourceModel/Oauth/Token/RequestLog.php
Outdated
Show resolved
Hide resolved
Updated the code according to the standards of phpdocumenter with inheritdoc. Co-authored-by: Barny Shergold <[email protected]>
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are also getting this fail - Failed asserting that '2021-09-07 13:04:59' contains "2021-09-07 13:05". (testEditCompanyActionLogging) /var/www/html/dev/tests/integration/testsuite/Magento/Company/LoggingTest.php
app/code/Magento/Integration/Model/ResourceModel/Oauth/Token/RequestLog.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests now passing
Hi @BarnyShergold, thank you for the review. |
@engcom-Alfa , Please approve the changes or let me know if there is any change needed. 😄 |
@magenti run all tests |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run all tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
@magento run Integration Tests,WebAPI Tests |
The requested builds are added to the queue. You should be able to see them here within a few minutes. Please re-request them if they don't show in a reasonable amount of time. |
It seems that all the review comments has been taken care so moving it further. Thank you! |
Re-tested today completely and the report remains same as mentioned in above-comment. Hence moving it to Merge In Progress. |
Hi @sagar2009kumar, thank you for your contribution! |
Description (*)
This pull request solves the issue when a customer has tried too many fail attempt (i.e more no of times than in the configuration)for generating the customer token via graphql or rest api. Then the customer is not able to log into the system ever.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Questions or comments
The issue was occuring because in the current system, there was no any check if
lock_expires_at
inoauth_token_request_log
is greater than current date time. So, the system always returns the no of failed attempts.For example, let's say, if the configured no of failed attempt is 6. And the customer has tried 7 times to generate the customer token via graphql api. Now, after the expiry time of
lock_expires_at
even when he/she tries with correct credentials, he/she is not able to generate the customer token and get the exception'The account sign-in was incorrect or your account is disabled temporarily. '

. 'Please wait and try again later.'
This is a major issue for the Scandi PWA login as customer is not able to logged into the PWA after trying too many unsuccessful attempt.
To resolve the issue, i have applied the check if
lock_expires_at
is greater than current date time. Then we got zero token in that case and when the customer login with correct credentials, he/she will log into the system.Please let me know if you need additional test cases (i have to make the test cases, lol) or any other description you want.
Contribution checklist (*)
Resolved issues: